home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / ENCRYPT.SWG / 0015_Encode-Decode w- Password.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-31  |  23KB  |  631 lines

  1. (*-----
  2.         Program                : CODE/DECODE
  3.  
  4.         File                : Code.Pas
  5.  
  6.         Version                : 1.2
  7.  
  8.         Author(s)        : Mark Midgley
  9.  
  10.         Date
  11.          (Started)        : April 11, 1990
  12.         Date
  13.          (Finished)        : , 1990
  14.  
  15.         Comment(s)        :
  16.  
  17. -----*)
  18. Program Code_and_DeCode;
  19.  
  20.  
  21. {$IFDEF DEBUG}
  22.         {$D+}                (* Turn Debugging Info **ON** *)
  23.         {$L+}                (* Turn Local Symbols  **ON** *)
  24.         {$R+}                (* Turn Range Checking **ON** *)
  25.         {$S+}                (* Turn Stack Checking **ON** *)
  26. {$ELSE}
  27.         {$D-}                (* Turn Debugging Info **OFF** *)
  28.         {$L-}                (* Turn Local Symbols  **OFF** *)
  29.         {$R-}                (* Turn Range Checking **OFF** *)
  30.         {$S-}                (* Turn Stack Checking **OFF** *)
  31. {$ENDIF}
  32.  
  33. Uses
  34.         Crt,
  35.         Dos;
  36.  
  37. Const
  38.         BufSize                =        512;
  39.         Version                =        '1.3';
  40.         MaxError    =        7;
  41.  
  42. Type
  43.         EDMode                        =        (EnCrypt,EnCryptPass,DeCrypt);
  44.         String79                =        String[79];
  45.         FilePaths                =        Array [1..2] Of String79;
  46.         Errors                        =        1..(MaxError - 1);
  47.  
  48. Procedure WriteXY( X,Y : Byte; S : String79 );
  49. Begin        (* WriteXY *)
  50.         GotoXY(X,Y);
  51.         Write(S);
  52. End;        (* WriteXY *)
  53.  
  54. Function UpStr( S : String ) : String;
  55. Var
  56.         X        : Byte;
  57.  
  58. Begin        (* UpStr *)
  59.         For X := 1 To Length(S) Do
  60.                 S[x] := (UpCase(S[x]) );
  61.         UpStr := S;
  62. End;        (* UpStr *)
  63.  
  64. Procedure Center( Y : Byte; S : String; OverWriteMode : Errors );
  65. Var
  66.         X : Byte;
  67.  
  68. Begin        (* Center *)
  69.         GotoXY(1,Y);
  70.         Case (OverWriteMode) of
  71.                 1        : For X := 2 To 78 Do WriteXY(X,WhereY,' ');
  72.                 2        : ClrEOL;
  73.         End;        (* Case *)
  74.         X := ((79 - Length(S)) Div 2);
  75.         If (X <= 0) Then X := 1;
  76.         WriteXY(X,Y,S);
  77. End;        (* Center *)
  78.  
  79. Procedure OutError( S : String79; X,OWM : Errors );
  80. Var
  81.         T : String79;
  82.  
  83. Begin        (* OutError *)
  84.         GotoXY(1, WhereY);
  85.         Case ( X ) Of
  86.                 1        : T := ('Incorrect Number of parameters.');
  87.                 2        : T := ('Input file "'+ S +'" not found.');
  88.                 3        : T := ('Input and Output files conflict.');
  89.                 4        : T := ('User Aborted!');
  90.                 5        : T := ('Input file "'+ S +'" is corrupted!');
  91.                 6        : If (T = '') Then T := ('DOS Input/Output Failure.')
  92.                                 Else T := S;
  93.         End;        (* Case *)
  94.         TextColor(LightRed);
  95.         Center(WhereY,T,OWM);
  96.         TextColor(LightGray);
  97.         If (OWM = 1) Then WriteLn;
  98.         WriteLn;
  99.         Halt(x);
  100. End;        (* OutError *)
  101.  
  102. Procedure HelpScreen( FullScreen : Boolean );
  103. Begin        (* HelpScreen *)
  104.         TextColor(LightGray);
  105.         GotoXY(1,WhereY);
  106.         WriteLn('               USAGE: CODE [/D|/E|/P] INPUT_FILE OUTPUT_FILE');
  107.         WriteLn('                  Options are: /D Decode File.');
  108.         WriteLn('                               /E Encode File.');
  109.         WriteLn('                               /P Encode with Password.');
  110.         If (Not FullScreen) Then Halt(MaxError);
  111.         WriteLn;
  112.         WriteLn('Description:');
  113.         WriteLn;
  114.         WriteLn('  CODE  encrypts a  DOS  file  to  garbage using  a  randomly  generated  seed');
  115.         WriteLn('  and then back again.  For  more protection, the password  option can be used.');
  116.         WriteLn('  Note:  With no  option, CODE defaults to encode "/E";  Input and Output files');
  117.         WriteLn('  must be different;  the "/P" option will  prompt  for the password  and  echo');
  118.         WriteLn('  dots;  Code does not allow wildcards;  Pressing  ESCape during operation will');
  119.         WriteLn('  abort.  The author  does  not  guarantee  the reliability of this program and');
  120.         WriteLn('  is not responsible for  any data lost.  If you appreciate this program in any');
  121.         WriteLn('  way or value its use then please send $5.00 - $20.00 to:');
  122.         WriteLn;
  123.         TextColor(White);
  124.         WriteLn('                                        Mark "Zing" Midgley');
  125.         WriteLn('                                        843 East 300 South');
  126.         WriteLn('                                        Bountiful Ut, 84010');
  127.         TextColor(LightGray);
  128.         Halt(MaxError);
  129. End;         (* HelpScreen *)
  130.  
  131. Function Shrink( P : PathStr ) : String79;
  132. Var
  133.         D        : DirStr;
  134.         N        : NameStr;
  135.         E        : ExtStr;
  136.  
  137. Begin        (* Shrink *)
  138.         FSplit(P,D,N,E);
  139.         Shrink := N + E;
  140. End;        (* Shrink *)
  141.  
  142. Procedure GraphIt( Var F1, F2        : File;
  143.                                    Var OldX                : Byte;
  144.                                    Hour,
  145.                                    Min,
  146.                                    Sec,
  147.                                    Sec100                : Word;
  148.                                    BoxSetUp                : Boolean );
  149. Var
  150.         F1Size,
  151.         F2Size        : LongInt;
  152.         Percent,
  153.         X,
  154.         NewX        : Byte;
  155.         H,
  156.         M,
  157.         S,
  158.         S100        : Word;
  159.         A,
  160.         B,
  161.         C,
  162.         D,
  163.         Temp        : String79;
  164.  
  165. Begin        (* GraphIt *)
  166.         If (BoxSetUp) Then
  167.         Begin
  168.                 Percent := 0;
  169.                 OldX := 3;
  170.                 GotoXY(1,WhereY);
  171.                 WriteLn('╔═════════════════════════════════════════════════════════════════════════════╗');
  172.                 WriteLn('║                                                                             ║');
  173.                 WriteLn('╚═════════════════════════════════════════════════════════════════════════════╝');
  174.                 GotoXY(3,WhereY - 2);
  175.         End Else
  176.         Begin
  177.                 GetTime(H,M,S,S100);
  178.                 If (Sec100 <= S100) Then Dec(S100,Sec100)
  179.                         Else
  180.                         Begin
  181.                                 S100 := (S100 + 100 - Sec100);
  182.                                 If (S > 0) Then Dec(S);
  183.                         End;
  184.                 If (Sec <= S) Then Dec(S,Sec)
  185.                         Else
  186.                         Begin
  187.                                 S := (S + 60 - Sec);
  188.                                 If (M > 0) Then Dec(M);
  189.                         End;
  190.                 If (Min <= M) Then Dec(M,Min)
  191.                         Else
  192.                         Begin
  193.                                 M := (M + 60 - Min);
  194.                                 If (H > 0) Then Dec(H);
  195.                         End;
  196.                 If (Hour <= H) Then Dec(H,Hour)
  197.                         Else H := (H + 12 - Hour);
  198.                 Str(H,A);
  199.                 Str(M,B);
  200.                 Str(S,C);
  201.                 Str(S100,D);
  202.                 Case (S100) of
  203.                         0..9        : D := ('0' + D);
  204.                 End;        (* Case *)
  205.                 If (M > 0) Then
  206.                 Case (S) of
  207.                         0..9        : C := ('0' + C);
  208.                 End;        (* Case *)
  209.                 If (H > 0) Then
  210.                 Case (M) of
  211.                         0..9        : B := ('0' + B);
  212.                 End;        (* Case *)
  213.                 If (H = 0) Then
  214.                 Begin
  215.                         If (M = 0) Then Temp := (Concat(C,'.',D,' sec') )
  216.                         Else Temp := (Concat(B,' min ',C,'.',D,' sec') );
  217.                 End
  218.                 Else If (H = 1) Then Temp := (Concat(A,' hr ',B,' min ',C,'.',D,' sec') )
  219.                                 Else Temp := (Concat(A,' hrs ',B,' min ',C,'.',D,' sec') );
  220.             F1Size := FileSize(F1);
  221.                 F2Size := FileSize(F2);
  222.                 If (F2Size <= F1Size) Then
  223.                 Percent := ((F2Size * 100) Div F1Size )
  224.                         Else Percent := 100;
  225.                 NewX := (((Percent * 76) Div 100) + 2);
  226.                 If (NewX < 3) Then NewX := 3;
  227.                 For X := OldX To NewX Do WriteXY(X,WhereY,#176);
  228.                 OldX := NewX;
  229.                 Center(WhereY + 1,(#181 + ' ' + Temp + ' ' + #198),3);
  230.                 GotoXY(NewX,WhereY - 1);
  231.         End;
  232. End;        (* GraphIt *)
  233.  
  234. Procedure Rm( FileName : String79 );
  235. Var
  236.         F : File;
  237.  
  238. Begin        (* Rm *)
  239.         If (FileName = '') Then Exit;
  240.         Assign(F,FileName);
  241.         Erase(F);
  242. End;        (* Rm *)
  243.  
  244. Procedure GetStr( Var S : String79; Prompt,FName : String79; Show : Boolean );
  245. Var
  246.         Max,
  247.         Min        : Byte;
  248.         A        : Char;
  249.         X        : Byte;
  250.  
  251. Begin        (* GetStr *)
  252.         If (FName = '') Then
  253.         Begin
  254.                 Max := 54;
  255.                 Min := 0
  256.         End Else
  257.         Begin
  258.                 Max := 25;
  259.                 Min := 3
  260.         End;
  261.         TextColor(LightGray);
  262.         WriteXY(1,WhereY,Prompt);
  263.         Repeat
  264.                 GotoXY(Length(Prompt) + 1,WhereY);
  265.                 ClrEOL;
  266.                 If (Show) Then WriteXY(Length(Prompt) + 1,WhereY,S)
  267.                 Else For X := 1 To Length(S) Do Write(#249);
  268.                 A := (ReadKey);
  269.                 Case ( A ) of
  270.                         #32..#126 :
  271.                                 If (Length(S) < Max) Then S := S + A
  272.                                 Else
  273.                                 Begin
  274.                                         Sound(100);
  275.                                         Delay(12);
  276.                                         NoSound;
  277.                                 End;
  278.                         #8 :
  279.                                 If (Length(S) > 0) Then
  280.                                         Delete(S,(Length(S) ), 1);
  281.                         #0 :
  282.                                 A := ReadKey;
  283.                         #27:
  284.                                 Begin
  285.                                         Rm(FName);
  286.                                         OutError('',4,2);
  287.                                 End;
  288.                 End;        (* Case *)
  289.         Until (A = #13) And (Length(S) >= Min);
  290. End;        (* GetStr *)
  291.  
  292. Function RealFile( St : String79; OWM : Errors ) : Boolean;
  293. Var
  294.         Error : Word;
  295.         F          : File;
  296.  
  297. Begin        (* RealFile *)
  298.         RealFile := False;
  299.         Assign(F,St);
  300.         {$I-}                 (* Turn Input/Output-Checking Switch Off *)
  301.         Reset(F);        (* Open file. *)
  302.         Error := IOResult;
  303.         {$I+}            (* Turn Input/Output-Checking Switch On  *)
  304.         If (Error = 0) Then (* File exists. *)
  305.         Begin
  306.                 RealFile := True;
  307.                 Close(F);
  308.         End Else
  309. {*}                Case (Error) Of
  310.                         152        : OutError('Drive Not Ready.',6,OWM);
  311.                         3        : OutError('Invalid Drive specification.',6,OWM);
  312.                         (* 5  : Directory *)
  313.                 End;        (* Case *)
  314. End;        (* RealFile *)
  315.  
  316. Procedure CheckError( FileName, Msg : String79 );
  317. Var
  318.         Error : Word;
  319.  
  320. Begin        (* CheckError *)
  321.         Error := IOResult;
  322.         If (Error <> 0) Then
  323.         Begin
  324.                 If (Error <> 152) And
  325.                    (Error <> 3) Then Rm(FileName)
  326.                         Else Msg := ('Drive Not Ready.');
  327.                 OutError(Msg,6,1);
  328.         End;
  329. End;        (* CheckError *)
  330.  
  331. Procedure CheckAbort( FileName : String79 );
  332. Begin        (* CheckAbort *)
  333.         If (KeyPressed) Then
  334.         If (ReadKey = #27) Then
  335.         Begin
  336.                 Rm(FileName);
  337.                 OutError('',4,1);
  338.         End;
  339. End;        (* CheckAbort *)
  340.  
  341. (*----
  342.         Procedure Encode();
  343.  
  344.         Author(s)        :        Mark Midgley
  345.                                         Louis Zirkel
  346.  
  347.         Comments        :        Cool Man...
  348.  
  349. ----*)
  350.  
  351. Procedure EnCode( _File : FilePaths; Protect : Boolean );
  352. Var
  353.         Seed,
  354.         PI,
  355.         Y,
  356.         OldX                : Byte;
  357.         I,
  358.         Increment        : Integer;
  359.         Buf                        : Array [1..BufSize] of Char;
  360.         Hour,
  361.         Min,
  362.         Sec,
  363.         Sec100,
  364.         Status                : Word;
  365.         Temp,
  366.         Pass                : String79;
  367.         F1,
  368.         F2                        : File;
  369.  
  370. Begin        (* EnCode *)
  371.         Pass := '';
  372.     {$I-}
  373.         Assign(F1, _File[1]);        (* input file  *)
  374.         Assign(F2, _File[2]);        (* output file *)
  375.         Reset(F1,1);
  376.         CheckError('','Couldn''t open input file.');
  377.         ReWrite(F2,1);
  378.         CheckError(_File[2],'Couldn''t create output file.');
  379.         Randomize;
  380.         If (Protect) Then
  381.         Begin
  382.                 GetStr(Pass,'(3 Char min, 25 Char max) Enter Password: ',_File[2],False);
  383.                 Buf[1] := Chr(Random(127) );
  384.                 BlockWrite(F2,Buf[1],SizeOf(Buf[1]),Status);
  385.                 CheckError(_File[2],'Couldn''t write to output file.');
  386.         End Else
  387.         Begin
  388.                 Buf[1] := Chr(Random(127) + 127);
  389.                 BlockWrite(F2,Buf[1],SizeOf(Buf[1]),Status);
  390.                 CheckError(_File[2],'Couldn''t write to output file.');
  391.         End;
  392.         Seed := Ord(Buf[1]);
  393.         Increment := 1;
  394.         PI := 1;
  395.         Y := 127;
  396.     TextColor(LightGray);
  397.         ClrEOL;
  398.         GetTime(Hour,Min,Sec,Sec100);
  399.         GraphIt(F1,F2,OldX,Hour,Min,Sec,Sec100,True);
  400.         Repeat
  401.                 BlockRead(F1, Buf, BufSize, Status);
  402.                 CheckError(_File[2],'Couldn''t read input file.');
  403.                 CheckAbort(_File[2]);
  404.                 GraphIt(F1,F2,OldX,Hour,Min,Sec,Sec100,False);
  405.                 For I := 1 To BufSize Do
  406.                         Begin
  407.                                 If (Protect) Then
  408.                                         Begin
  409.                                                 Buf[I] := Char(Byte(Buf[I]) XOR Byte(Pass[PI]));
  410.                                                 If (PI = Length(Pass)) Then Increment := -1;
  411.                                                 If (PI = 1) Then Increment := 1;
  412.                                                 Inc(PI,Increment);
  413.                                         End
  414.                                 Else
  415.                                         Begin
  416.                                                 Buf[I] := Char(Byte(Buf[I]) XOR Y);
  417.                                         End;
  418.                         End;
  419.                 BlockWrite(F2, Buf, Status);
  420.                 CheckError(_File[2],'Couldn''t write to output file.');
  421.         Until (Status < BufSize);
  422.         Close(F1);
  423.         CheckError(_File[2],'Couldn''t close input file.');
  424.         Close(F2);
  425.         CheckError(_File[2],'Couldn''t close output file.');
  426.         {$I+}
  427. (* Successful Encryption *)
  428.         TextColor(LightGray);
  429.         Temp := (Shrink(_File[1]) +' Encoded to '+ Shrink(_File[2]));
  430.         If (Protect) Then Temp := (Temp + ' with Password.');
  431.         Center(WhereY,Temp,1);
  432.         GotoXY(1,WhereY + 1);
  433.         WriteLn;
  434. End;        (* EnCode *)
  435.  
  436. (*----
  437.         Procedure DeCode();
  438.  
  439.         Author(s)        :        Mark Midgley
  440.                                         Louis Zirkel
  441.  
  442.         Comments        :        Cool Man...
  443.  
  444. ----*)
  445.  
  446. Procedure DeCode( _File : FilePaths );
  447. Var
  448.         Seed,
  449.         PI,
  450.         Y,
  451.         OldX                : Byte;
  452.         I,
  453.         Increment        : Integer;
  454.         Buf                        : Array [1..BufSize] of Char;
  455.         Hour,
  456.         Min,
  457.         Sec,
  458.         Sec100,
  459.         Status                : Word;
  460.         Temp,
  461.         Pass                : String79;
  462.         F1,
  463.         F2                        : File;
  464.  
  465. Begin        (* DeCode *)
  466.         Pass := '';
  467.         {$I-}
  468.         Assign(F1, _File[1]);
  469.         Assign(F2, _File[2]);
  470.         Reset(F1,1);
  471.         CheckError('','Couldn''t open input file.');
  472.         ReWrite(F2,1);
  473.         CheckError(_File[2],'Couldn''t create output file.');
  474.         BlockRead(F1,Buf[1],SizeOf(Buf[1]),Status);
  475.         CheckError(_File[2],'Couldn''t read input file.');
  476.         Seed := Ord(Buf[1]);
  477.         If (Buf[1] < #127) Then (* There's a Password *)
  478.                 GetStr(Pass,'Enter Password: ',_File[2],False);
  479.         Increment := 1;
  480.         PI := 1;
  481.         Y := 127;
  482.         TextColor(LightGray);
  483.         ClrEOL;
  484.         GetTime(Hour,Min,Sec,Sec100);
  485.         GraphIt(F1,F2,OldX,Hour,Min,Sec,Sec100,True);
  486.         Repeat
  487.                 BlockRead(F1, Buf, BufSize, Status);
  488.                 CheckError(_File[2],'Couldn''t read input file.');
  489.                 GraphIt(F1,F2,OldX,Hour,Min,Sec,Sec100,False);
  490.                 CheckAbort(_File[2]);
  491.                 For I := 1 To BufSize Do
  492.                         Begin
  493.                                 If (Pass <> '') Then (* There's a Password *)
  494.                                         Begin
  495.                                                 Buf[I] := Char(Byte(Buf[I]) XOR Byte(Pass[PI]));
  496.                                                 If (PI = Length(Pass)) Then Increment := -1;
  497.                                                 If (PI = 1) Then Increment := 1;
  498.                                                 Inc(PI,Increment);
  499.                                         End
  500.                                 Else
  501.                                         Begin
  502.                                                 Buf[I] := Char(Byte(Buf[I]) XOR Y);
  503.                                         End;
  504.                         End;
  505.                 BlockWrite(F2, Buf, Status);
  506.                 CheckError(_File[2],'Couldn''t write to output file.');
  507.         Until (Status < BufSize);
  508.         Close(F1);
  509.         CheckError(_File[2],'Couldn''t close input file.');
  510.         Close(F2);
  511.         CheckError(_File[2],'Couldn''t close output file.');
  512.         {$I+}
  513. (* Successful Decryption *)
  514.         Center(WhereY,Shrink(_File[1]) +' Decoded to '+ Shrink(_File[2]),1);
  515.         GotoXY(1,WhereY + 1);
  516.         WriteLn;
  517. End;        (* DeCode *)
  518.  
  519. Procedure CheckParameters;
  520. Var
  521.         _File        : FilePaths;
  522.         Temp        : String79;
  523.         Mode        : EDMode;
  524.         OkMode,
  525.         Input1,
  526.         Input2        : Boolean;
  527.         X                : Byte;
  528.  
  529. Begin        (* CheckParameters *)
  530.         For X := 1 To 2 Do _File[x] := '';
  531.         Mode := EnCrypt;
  532.         OkMode := False;
  533.         X := 1;
  534.         While (X <= ParamCount) Do
  535.         Begin
  536.                 Temp := (UpStr(ParamStr(x) ) );
  537.                 If (Pos('?',Temp) > 0) or (Pos('*',Temp) > 0) Then HelpScreen(True);
  538.                 If ((Temp[1] = '/') or (Temp[1] = '-')) And
  539.                   (Length(Temp) = 2) And (Not OkMode) Then
  540.                 Begin
  541.                         Case (Temp[2]) of
  542.                                 'E'        : Begin
  543.                                                 Mode := EnCrypt;
  544.                                                 OkMode := True;
  545.                                           End;
  546.                                 'D' : Begin
  547.                                                 Mode := DeCrypt;
  548.                                                 OkMode := True;
  549.                                           End;
  550.                                 'P' : Begin
  551.                                                 Mode := EnCryptPass;
  552.                                                 OkMode := True;
  553.                                           End;
  554.                                 'H',
  555.                                 '?' : HelpScreen(True);
  556.                                 Else
  557.                                         OkMode := False;
  558.                         End;        (* Case *)
  559.                 End Else
  560.                 Begin
  561.                         If (_File[1] = '') Then _File[1] := Temp Else
  562.                         If (_File[2] = '') Then _File[2] := Temp;
  563.                 End;
  564.                 Inc(x);
  565.         End;
  566.         If (_File[1] = '') Then
  567.         Begin
  568.                 GetStr(_File[1],'Enter Input Path/File : ','',True);
  569.                 Input1 := True;
  570.                 _File[1] := (UpStr(_File[1]) );
  571.         End Else Input1 := False;
  572.         If (_File[2] = '') Then
  573.         Begin
  574.                 GetStr(_File[2],'Enter Output Path/File : ','',True);
  575.                 Input2 := True;
  576.                 _File[2] := (UpStr(_File[2]) );
  577.         End Else Input2 := False;
  578.         If (Pos('?',_File[1]+_File[2]) > 0) or (Pos('*',_File[1]+_File[2]) > 0)
  579.                 Then HelpScreen(True);
  580.         If (Not OkMode) And ((Input1) or (Input2)) And
  581.            (_File[1] <> '') And (_File[2] <> '') Then
  582.         Begin
  583.                 WriteXY(1,WhereY,'[E]ncode, Encode with [P]assword, or [D]ecode? ');
  584.                 ClrEOL;
  585.                 Case (UpCase(ReadKey) ) of
  586.                         'E' : Mode := EnCrypt;
  587.                         'D' : Mode := DeCrypt;
  588.                         'P' : Mode := EnCryptPass;
  589.                         #27 : OutError('',4,2);
  590.                 End;        (* Case *)
  591.         End Else If (_File[1] = '') or (_File[2] = '') Then HelpScreen(False);
  592.         If ((ParamCount < 2) or (ParamCount > 3)) And
  593.            (_File[1] = '') And (_File[2] = '') Then OutError('',1,2);
  594.         If (Not(RealFile(_File[1],2) ) ) Then OutError(Shrink(_File[1]),2,2);
  595.         If (RealFile(_File[2],2) ) Then
  596.         Begin
  597.                 If (FExpand(_File[1]) = FExpand(_File[2]) ) Then OutError('',3,2);
  598.                 TextColor(Red);
  599.                 WriteXY(1,WhereY,'Warning! "');
  600.                 TextColor(LightRed);
  601.                 Write(Shrink(_File[2]) );
  602.                 TextColor(Red);
  603.                 Write('" already exists...Replace ([Y],N)? ');
  604.                 ClrEOL;
  605.                 Case (UpCase(ReadKey) ) Of
  606.                         'N',#27 : OutError('',4,2);
  607.                 End;        (* Case *)
  608.         End;
  609.         If (Mode = EnCryptPass) Then EnCode(_File,True);
  610.         If (Mode = EnCrypt) Then EnCode(_File,False);
  611.         If (Mode = DeCrypt) Then DeCode(_File);
  612. End;        (* CheckParameters *)
  613.  
  614. Procedure Main;
  615. Begin        (* Main *)
  616.         CheckBreak := False;
  617.         TextColor(LightGray);
  618.         WriteLn;
  619.         ClrEOL;
  620.         WriteXY(12,WhereY,'DOS file Encrypter v' + Version + ' by ');
  621.         TextColor(LightBlue);
  622.         Write('Zing Merway');
  623.         TextColor(LightGray);
  624.         WriteLn('  CODE/h for Help.');
  625.         WriteLn;
  626.         CheckParameters;
  627. End;        (* Main *)
  628.  
  629. Begin        (* Code *)
  630.         Main;
  631. End.        (* Code *)